package com.yc.spring;

import java.util.List;


import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySources;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;

import com.yc.entity.Student;
import com.yc.jpa.dao.GradeDao;
import com.yc.jpa.dao.StudentDao;
import com.yc.jpa.service.JpaDemoService;

@RunWith(SpringJUnit4ClassRunner.class) 
@ContextConfiguration(value= {"/applicationContext.xml","/jpa-context.xml"}) 
public class SpringTestDemo {
	
	@Autowired 
    private StudentDao studentDao;
	
	@Autowired
    private SpringContextAwareFactory springContextAwareFactory;
	
//	@Autowired 
//    private GradeDao gradeDao;
	
//	@Autowired 
//    private JpaDemoService jpaDemoService;

//	@Test
//	public void testDQuery() {
////		ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml"); 
////		StudentDao studentDao = ctx.getBean(StudentDao.class);
//		
//		List<Student> list1 = studentDao.findMyTel("1885656565");
//		System.out.println(list1.get(0).getName());
////		System.out.println("---------------------");
////		List<String> list2 = studentDao.findAllTel();
////		for (String tel : list2) {
////			System.out.println(tel);
////		}
////		gradeDao.test();
//		
////		jpaDemoService.testJpa();
//		
//	}
	
	@Test
	public void testContextAwareFactory() {
		springContextAwareFactory.getHandleService();
	}
}
